import os

def rename_files(folder_path):
    for filename in os.listdir(folder_path):
        if filename.count('-') >= 2:
            parts = filename.split('-')
            if len(parts) > 2:
                new_filename = parts[0] + '-' + parts[2]
                old_file_path = os.path.join(folder_path, filename)
                new_file_path = os.path.join(folder_path, new_filename)
                try:
                    os.rename(old_file_path, new_file_path)
                    print(f"已将 {filename} 重命名为 {new_filename}")
                except Exception as e:
                    print(f"重命名 {filename} 时出错: {e}")


if __name__ == "__main__":
    folder_path = 'download_861433076312363_20250509-20250603'  # 请替换为实际的文件夹路径
    rename_files(folder_path)